<?php
defined('APP_ROOT') || define('APP_ROOT', dirname(__FILE__));
date_default_timezone_set('PRC');
require APP_ROOT.'/Core/vendor/autoload.php';
function __autoload($classname){
	$classname = str_replace('_','/',$classname);
    $classpath = APP_ROOT."/Core/".$classname.'.php';
    if(file_exists($classpath)){
        require_once($classpath);
    }else{
        die('class file'.$classpath.'not found!');
    }
}

function phpescape($str){
    $sublen=strlen($str);
    $retrunString="";
    for ($i=0;$i<$sublen;$i++){
        if(ord($str[$i])>=127){
            $tmpString=bin2hex(iconv("gb2312","ucs-2",substr($str,$i,2)));
            $retrunString.="%u".$tmpString;
            $i++;
        } else {
            $retrunString.="%".dechex(ord($str[$i]));
        }
    }
    return $retrunString;
}